package com.bxl;

import com.bxl.pojo.News;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;

public class NewsJdbc2 {

    public static void main(String[] args) throws SQLException {
         SelectNews selectNews = new SelectNewsImpl();
        //查询
         /* List<News> list = selectNews.selectNewa(1);
        List<News> list = selectNews.selectNewa("军事");
        for (News news: list) {
            System.out.println(
                    news.getId()+"--->"+news.getTitle()
            );
        }*/

        //删除
       /* DeleteNews deleteNews = new DeleteNewsImpl();
        int count=deleteNews.deleteById(2);
        System.out.println(count>0?"删除成功":"删除失败");*/

        //修改
        UpdateNews updateNews = new UpdateNewsImpl();
        int count=updateNews.updateById(1,"国际组织");
        System.out.println(count>0?"修改成功":"修改失败");
    }

}
